package ma.view.gui.parameterPanels;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.swing.JPanel;

import ma.view.gui.EBenchmarkPanel;

/**
 * A {@code ParameterPanel} shows parameter panels on a JPanel. This is
 * both for input and output parameters.
 * @author Oliver Eckstein
 *
 */
public abstract class ParameterPanel 
    extends EBenchmarkPanel {

    private static final long serialVersionUID = 1L;
    
    protected String panelTitle;
    protected JPanel parametersPanel = new JPanel();    
    protected Map<Integer, ArrayList<JPanel>> parameterPanelsMap =
            new HashMap<Integer, ArrayList<JPanel>>();    
    
    
    /**
     * To create a new instance of {@code ParameterPanelsPanel}. Always
     * calls {@code createPanel} at first.
     * @param parameters map that contains the information about the
     * parameter's panels to be created. This is for parameters that <b>are not
     * connected</b> to a geometry set.
     * @param parameterSets map that contains the information about the
     * parameter's panels to be created. This is for parameters that <b>are
     * connected</b> to a geometry set.
     */
    public ParameterPanel(String logoPath, String panelTitle) {
        super(logoPath);
        this.panelTitle = panelTitle;
        createPanel();
    }
    
    /**
     * To add a parameter panel.
     * @param parameterInformation the parameter's information
     */
    public abstract void addParameterPanel(String[] parameterInformation);
    
    /**
     * To add a parameter panel that is connected to a geometry set.
     * @param parametersInformation the parameters' information
     * @param geometrySetIndex the parameter's index of the geometry sets
     */
    public abstract void addParameterPanel(
            List<String[]> parametersInformation, String borderTitle);
    
    
    
    /**
     * To set the panel's initial conditions.
     */
    protected abstract void createPanel();
    
    /**
     * To get the panel where the resulting parameters get written.
     * @return the result parameters panel.
     */
    public JPanel getResultParametersPanel() {
        return parametersPanel;
    }
    
}
